package priv.pront.code.national.acwing.competition;

import java.util.Scanner;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-06-03 19:07
 */
public class Acwing5032_字符串操作 {

        static int n, m;
        public static void main(String[] args){
            Scanner scanner = new Scanner(System.in);
            n = scanner.nextInt(); m = scanner.nextInt();
            String s = scanner.next();
            char[] chs = s.toCharArray();
            while(m-- > 0){
                int x = scanner.nextInt() - 1;
                int y = scanner.nextInt() - 1;
                char a = scanner.next().charAt(0);
                char b = scanner.next().charAt(0);
                for(int i = x; i <= y; i++){
                    if(chs[i] == a){chs[i] = b;}
                }
            }
            System.out.println(new String(chs));
        }
}
